<?php
require("inc/common.inc.php");
$rentype=intval($rentype);
if ($rentype==1){
	$mobile=trim($mobile);
	$mac=trim($mac);
	$Rid=intval($Rid);
	//是否为空
	if($mobile=="" or $Rid==0 or $mac=="" or strlen($mac)!=12){echo "0";exit();}
	//验证来路
	$truepath=preg_replace("/(.+)\/([^\/]+)\/([^\/]+)/is","\\1",'http://'.$HTTP_HOST);
	if ($webdb[weburl]!=$truepath){echo "0";exit();}
	//验证手机号格式
	if(!eregi("^[0-9]{11,11}$",$mobile)){echo "0";exit();}

	$getcode=file_get_contents($VPPWIFIURL."wifirenzheng_mx.php?rentype=1&mobile=$mobile&mac=$mac&Rid=$Rid&shang={$VPPWIFISHANG}&sign=".md5($mac."{mx}".$VPPWIFISHANG."{z}".$mobile."{w}".$Rid));
	echo intval($getcode);
}
elseif ($rentype==2){
	header("Content-type: text/html; charset=utf-8");
	$truepath=preg_replace("/(.+)\/([^\/]+)\/([^\/]+)/is","\\1",'http://'.$HTTP_HOST);
	if ($webdb[weburl]!=$truepath){
		$fun->popmassage("非法的认证","","popback");
		exit();
	}
//	if ($_COOKIE["mxadminwx"]["userid"]==""){
//		$fun->popmassage("非法的认证","","popback");
//		exit();
//	}
?>
<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1" name="viewport"> 
<title>获取微信验证码-<?php echo $webdb['vpp_jigoucode'];?></title>
<link href="images/style.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript" src="js/jquery_min.js"></script>
<body>
<?php //require("w_head.php");?>

<table width="90%" cellpadding="1" cellspacing="1" align="center"  bgcolor="#CCCCCC" style="margin-top:30px;">
	<tr bgcolor="#ededed"><td height="30" align="center"><b>恭喜你获取微信验证码成功</b></td></tr>
	<tr bgcolor="#FFFFFF"><td align="center" style="line-height:120%; font-size:1.4em; color:#FF0000;">
	<?php
	$getcode=file_get_contents($VPPWIFIURL."wifirenzheng_mx.php?rentype=2&shang={$VPPWIFISHANG}&sign=".md5($rentype."{mx}".$VPPWIFISHANGNAME."{wei}".$VPPWIFISHANG."{zhou}"));
//	if ($getcode==0){
//		echo "获取验证码失败";
//	}
//	else{
	echo intval($getcode);
//	}
	?>
	</td></tr>
</table>

<?php require("w_copyright.php");?>
</body>
</html>
<?php
}
else{echo "0";}
?>
